package com.github.kezhenxu94.acs;

import com.github.kezhenxu94.acs.common.Evaluater;
import com.github.kezhenxu94.acs.common.Model;
import com.github.kezhenxu94.acs.math.Matrix;

/**
 * Created by kezhenxu on Dec 19, 2016
 *
 * @author kezhenxu (kezhenxu94@163.com)
 */
public class Fitness implements Evaluater {

	@Override
	public double evaluate(Model model, Matrix dataSet) {
		ClusterSolutions solutions = (ClusterSolutions) model;
		int row = solutions.getEnvironment().getRowCount();
		int clusterCount = solutions.getEnvironment().getClusterCount();
		for (int i = 0; i < solutions.getSize(); i++) {
			Matrix weight = new Matrix(row, clusterCount, 0);
			for (int j = 0; j < row; j++) {
				weight.set(j, solutions.getSolution(i).getSolution(j), 1);
			}
			getLogger().info("model = " + model);
			getLogger().info("weight = " + weight);
		}
		return 0;
	}

}
